<!--
 * @Descripttion : 
 * @Autor        : Lilong
 * @Date         : 2022-09-14 12:14:19
 * @LastEditTime : 2022-09-14 12:39:16
 * @FilePath     : \src\BComponent.vue
-->
<template>
    <h3>B组件</h3>
</template>

<script>
    import Bus from "./bus"

    export default {
        name: 'BComponent',
        mounted(){
            // 监听事件的触发
            Bus.$on("sendMsg", data => {
                console.log("这是接收到的数据：", data)
            })
        },
        beforeDestroy(){
            // 取消监听
            Bus.$off("sendMsg")
        }
    }
</script>